#工具链接
#set(tools /home/hongji/sdk/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu)
set(tool_paths  /tools/Xilinx/Vitis/2020.1/gnu/aarch64/lin/aarch64-linux/
        /home/jimmy/Xilinx/Vitis/2020.1/gnu/aarch64/lin/aarch64-linux/
        /opt/aarch64-linux/
    )  
#设置liat值
foreach(tpath ${tool_paths}) 
     message("curpath ${tpath}")
     if(EXISTS ${tpath})
        set(tools ${tpath})
        message("set cross build tool ${tools}")
        break() 
     endif()
endforeach(tpath)   #结束

set(CMAKE_C_COMPILER ${tools}/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-linux-gnu-g++)
set(CMAKE_SYSTEM_NAME Linux)


include_directories(${PROJECT_SOURCE_DIR}/include/Xilinx)
#add_definitions(-std=c++11)
add_definitions(-D_PLAT_XILINX_)

#option(HAVE_TEST_VIDEO "use simulation video for test" ON)
option(HAVE_SERIAL_PORT "use serial port for imghost" ON)
option(HAVE_TEST_ENCODE_H265 "use encode h265" OFF)
option(HAVE_LRZ "use lrz tool" ON) #lrz串口工具
option(HAVE_TEST_VIDEO "use simulation video for test" OFF)
option(PLAT_XILINK "xilinx plat" ON)

if(HAVE_TEST_VIDEO)
add_definitions(-DHAVE_TEST_VIDEO)
endif()

add_definitions(-D_TEST_ENCODER)
set(simulate_video  
 ${PROJECT_SOURCE_DIR}/mod/simulate/frame_src_component.cpp 
 ${PROJECT_SOURCE_DIR}/mod/simulate/frame_src_composite.cpp 
 ${PROJECT_SOURCE_DIR}/mod/simulate/frame_src_file.cpp 
 ${PROJECT_SOURCE_DIR}/mod/simulate/simulate_app.cpp 
)

if(HAVE_TEST_ENCODE_H265)
add_definitions(-D_HAVE_ENCODE_H265_)
endif()
set(extra_lib HJ pthread)
set(axi_lib HJ)
set(plat xilinx)

include_directories(${PROJECT_SOURCE_DIR}/../mod/common)
include_directories(${PROJECT_SOURCE_DIR}/../mod/record)
include_directories(${PROJECT_SOURCE_DIR}/../mod/filebox/libflv/include)
include_directories(${PROJECT_SOURCE_DIR}/../mod/filebox/libmov/include)
include_directories(${PROJECT_SOURCE_DIR}/../mod/filebox/libmpeg/include)

#编解及录像程序编码相关
set(encoder enc_recorder)
set(encoder_lib record luaWrapper cross_com filebox allegro_encode pthread)
#解码
set(decoder_lib luaWrapper filebox allegro_decode pthread)

link_directories(${PROJECT_SOURCE_DIR}/lib/${plat}/)